<?php 
/* Widget Content */

/* Beginning of Category listing for localoffers page */
if(is_pod_page('localoffers')){
echo '<h2 class="widgettitle">Categories</h2>';
$category = new Pod('category');
$category->page = 1;
$category->search = false;
$where = "campaigns.camp_end >= ".fix_date()." && campaigns.camp_start <= ".fix_date()." && campaigns.sale=1 && t.is_local=1";
$category->findRecords("name ASC",-1,$where);
while($category->fetchRecord()){
$category_name = $category->get_field('name');
$category_url = $category->get_field('url');
echo '<strong><a href="'.BUZZR_URL.'/'.$category_url.'">'.$category_name.'</a></strong>';
echo '<br />';
}

$where = "campaigns.camp_end >= ".fix_date()." && campaigns.camp_start <= ".fix_date()." && campaigns.sale=1 && t.is_local=0 && t.is_daily=0";
$category->findRecords("name ASC",-1,$where);
while($category->fetchRecord()){
$category_name = $category->get_field('name');
$category_url = $category->get_field('url');
echo '<strong><a href="'.BUZZR_URL.'/'.$category_url.'">'.$category_name.'</a></strong>';
echo '<br />';
}

}
/* End of Category listing for localoffers page */

/* Beginning of Category listing for localoffers city page */
elseif(is_pod_page('localoffers/*') || is_pod_page('localoffers/*/c-*'))
{
$city = pods_url_variable('1');
echo '<h2 class="widgettitle">Categories</h2>';
$category = new Pod('category');
$category->page = 1;
$category->search = false;
$where = "campaigns.camp_end >= ".fix_date()." && campaigns.camp_start <= ".fix_date()." && campaigns.sale=1 && t.is_local=1";
$category->findRecords("name ASC",-1,$where);
while($category->fetchRecord())
{
$category_name = $category->get_field('name');
$category_url = $category->get_field('url');
echo '<strong><a href="'.BUZZR_URL.'/localoffers/'.$city.'/'.$category_url.'">'.$category_name.'</a></strong>';
echo '<br />';
}

$where = "campaigns.camp_end >= ".fix_date()." && campaigns.camp_start <= ".fix_date()." && campaigns.sale=1 && t.is_local=0";
$category->findRecords("name ASC",-1,$where);
while($category->fetchRecord())
{
$category_name = $category->get_field('name');
$category_url = $category->get_field('url');
echo '<strong><a href="'.BUZZR_URL.'/localoffers/'.$city.'/'.$category_url.'">'.$category_name.'</a></strong>';
echo '<br />';
}
}
/* End of Category listing for localoffers city page */

/* Beginning of Category listing for all other pages */
else{
?>

<h2 class="widgettitle">Categories</h2>
<?php
$category = new Pod('category');
$category->page = 1;
$category->search = false;
$where = "campaigns.camp_end >= ".fix_date()." && campaigns.camp_start <= ".fix_date()." && campaigns.dealcheck=1 && campaigns.sale=0 && t.is_local=0";
$category->findRecords("name ASC",-1,$where);
while($category->fetchRecord()){
$category_name = $category->get_field('name');
$category_url = $category->get_field('url');
echo '<strong><a href="'.BUZZR_URL.'/'.$category_url.'">'.$category_name.'</a></strong>';
echo '<br />';
}

}
/* End of Category listing for all other pages */ 

/* Widget Content */
?>

<?php
/* Widget Logic */ 
is_pod_page('deals') || is_pod_page('t-*') || is_pod_page('coupons') || is_pod_page('localoffers') || is_pod_page('localoffers/*') || is_pod_page('localoffers/*/c-*') || is_pod_page('c-vacation-offers') || is_pod_page('c-hotel-offers') || is_pod_page('c-flight-offers') || is_pod_page('c-*') || is_pod_page('deals-expiringsoon') || is_pod_page('deals-popular')
/* Widget Logic */ 
?>